/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/7/12 22:33
  *
  * @file       hd_storage.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/7/12     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_STORAGE_H
#define JLC_SKY_STORAGE_H

#include "stm32f4xx.h"

struct StorageVtbl;

typedef struct {
    struct StorageVtbl* vptr;
} Storage;

struct StorageVtbl {
    void (*read)(Storage* this, uint8_t* buffer, uint32_t address, uint32_t count);
};

void Storage_constructor(Storage* this);

static inline void Storage_read(Storage* this, uint8_t* buffer, const uint32_t address, uint32_t count) {
    (*this->vptr->read)(this, buffer, address, count);
}

// #define Storage_read(this, buf, addr, count) (*this->vptr->read)(this, buf, addr, count);

#endif //JLC_SKY_STORAGE_H
